<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>04_解构赋值.html</title>
</head>

<body>
    <script>
        // ES6 允许按照一定模式从数组和对象中提取值，对变量进行赋值
        //这被称为解构赋值
        //1.数组的结构
        const F4 = ['小声杨', '刘能', '找死', '宋小宝'];
        let [xiao, liu, zhao, song] = F4;
        // console.log(xiao);
        // console.log(liu);
        // console.log(zhao);
        // console.log(song);

        //2.对象的结构
        const shan = {
            name: '本山',
            age: 60,
            xiaoping: function () {
                console.log('本山演小品');
            }
        }
        let {
            name,
            age,
            xiaoping
        } = shan;
        // console.log(name);
        // console.log(age);
        // console.log(xiaoping);
        // xiaoping();
        let {xiaopin} = shan;
        console.log(shan);
    </script>

</body>

</html>